/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.cemaden.library.model.smp;

import br.gov.cemaden.library.model.BaseEntity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.codehaus.jackson.annotate.JsonBackReference;

/**
 *
 * @author paulo.dias
 */
@Entity
@Table(name = "smp_classes_aplic", schema = "smp")
@SequenceGenerator(name = "sequence", sequenceName = "smp.smp_classes_aplic_sequence", schema = "smp")
@NamedQueries({
    @NamedQuery(name = "ClassesAplic.findAll", query = "SELECT a FROM ClassesAplic a ORDER BY a.id ASC"),
    @NamedQuery(name = "ClassesAplic.findById", query = "SELECT a FROM ClassesAplic a WHERE a.id = :id"),
    @NamedQuery(name = "ClassesAplic.findByTotal", query = "SELECT a FROM ClassesAplic a WHERE a.total = :total"),
    @NamedQuery(name = "ClassesAplic.findByLoaded", query = "SELECT a FROM ClassesAplic a WHERE a.loaded = :loaded"),
    @NamedQuery(name = "ClassesAplic.findByUnLoaded", query = "SELECT a FROM ClassesAplic a WHERE a.unLoaded = :unLoaded"),
    @NamedQuery(name = "ClassesAplic.findByExecAplic;", query = "SELECT a FROM ClassesAplic a WHERE a.execAplic = :execAplic"),})
public class ClassesAplic implements Serializable, BaseEntity {

    @Id
    @GeneratedValue(generator = "sequence", strategy = GenerationType.AUTO)
    @Column(name = "id_classes_aplic", nullable = false, unique = true)
    private Long id;

    @Column(name = "total")
    private Double total;

    @Column(name = "loaded")
    private Double loaded;

    @Column(name = "unLoaded")
    private Double unLoaded;

    @OneToOne
    @JsonBackReference
    @JoinColumn(name = "id_exec_aplic", referencedColumnName = "id_exec_aplic", unique = true)
    private ExecAplic execAplic;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Double getTotal() {
        return total;
    }

    public void setTotal(Double total) {
        this.total = total;
    }

    public Double getLoaded() {
        return loaded;
    }

    public void setLoaded(Double loaded) {
        this.loaded = loaded;
    }

    public Double getUnLoaded() {
        return unLoaded;
    }

    public void setUnLoaded(Double unLoaded) {
        this.unLoaded = unLoaded;
    }

    public ExecAplic getExecAplic() {
        return execAplic;
    }

    public void setExecAplic(ExecAplic execAplic) {
        this.execAplic = execAplic;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ClassesAplic other = (ClassesAplic) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ClassesAplic{" + "id=" + id + ", total=" + total + ", loaded=" + loaded + ", unLoaded=" + unLoaded + ", execAplic=" + execAplic + '}';
    }
}
